parameters: (func_el)
docstring: Handle a plain function
docstring_summary: Handle a plain function
docstring_tokens: Handle a plain function
function: def function(func_el):
      """ Handle a plain function """
  
      func_name = func_el.get("name")
      func_alias = get_meth_alias(func_el)
  
      wglue("/// Pre-wrap function %s." % func_name)
      wglue("static inline int pwrap%s(lua_State* l)" % func_alias)
      wglue("{")
      ident(1)
      write_local_vars()
  
      check_args(func_el.find("args"), 0)
  
      # Args
      args_str = args(func_el.find("args"), 1)
  
      # Return value
      ret_txt = None
      ret_el = func_el.find("return")
      if ret_el is not None:
          ret_txt = ret_el.text
  
      # Call
      wglue("// Call the function")
      call = func_el.find("overrideCall")
      if call is not None:
          call = call.text
  
      if call is not None:
          wglue("%s" % call)
      else:
          if ret_txt is None:
              wglue("%s(%s);" % (func_name, args_str))
          else:
              wglue("%s ret = %s(%s);" % (ret_txt, func_name, args_str))
  
      wglue("")
      ret(ret_el)
  
      ident(-1)
      wglue("}")
      wglue("")
  
      # Write the actual function
      wglue("/// Wrap function %s." % func_name)
      wglue("static int wrap%s(lua_State* l)" % func_alias)
      wglue("{")
      ident(1)
      wglue("int res = pwrap%s(l);" % func_alias)
      wglue("if(res >= 0)")
      wglue("{")
      ident(1)
      wglue("return res;")
      ident(-1)
      wglue("}")
      wglue("")
      wglue("lua_error(l);")
      wglue("return 0;")
      ident(-1)
      wglue("}")
      wglue("")
function_tokens: def function ( func_el ) : func_name = func_el . get ( "name" ) func_alias = get_meth_alias ( func_el ) wglue ( "/// Pre-wrap function %s." % func_name ) wglue ( "static inline int pwrap%s(lua_State* l)" % func_alias ) wglue ( "{" ) ident ( 1 ) write_local_vars ( ) check_args ( func_el . find ( "args" ) , 0 ) # Args args_str = args ( func_el . find ( "args" ) , 1 ) # Return value ret_txt = None ret_el = func_el . find ( "return" ) if ret_el is not None : ret_txt = ret_el . text # Call wglue ( "// Call the function" ) call = func_el . find ( "overrideCall" ) if call is not None : call = call . text if call is not None : wglue ( "%s" % call ) else : if ret_txt is None : wglue ( "%s(%s);" % ( func_name , args_str ) ) else : wglue ( "%s ret = %s(%s);" % ( ret_txt , func_name , args_str ) ) wglue ( "" ) ret ( ret_el ) ident ( - 1 ) wglue ( "}" ) wglue ( "" ) # Write the actual function wglue ( "/// Wrap function %s." % func_name ) wglue ( "static int wrap%s(lua_State* l)" % func_alias ) wglue ( "{" ) ident ( 1 ) wglue ( "int res = pwrap%s(l);" % func_alias ) wglue ( "if(res >= 0)" ) wglue ( "{" ) ident ( 1 ) wglue ( "return res;" ) ident ( - 1 ) wglue ( "}" ) wglue ( "" ) wglue ( "lua_error(l);" ) wglue ( "return 0;" ) ident ( - 1 ) wglue ( "}" ) wglue ( "" )