FANDOM


Returns a compiled function from the strings provided by function.

load(func [, chunkname])

Parameters Edit

Arguments Edit

func
function - Repeatedly called to load a chunk from pieces. Each call to func must return a string that concatenates with previous results. A return of an empty string, nil, or no value signals the end of the chunk..
chunkname
string - chunkname is used as the chunk's designation for error messages and debug information. When absent, it defaults to "=(load)".

Returns Edit

function
function - If there are no errors, returns the compiled string as a function; otherwise, returns nil. The environment of the returned function is the global environment.
error
string - If there are no errors, returns nothing; otherwise, returns the error message.

Example Edit

The result is the character waves and a warning message of "OMG, HI!" flashes on the screen.

local function getitr(ary)
  local x=0
  return function()
    x=x+1
    return ary[x]
  end
end

local cmds={"DoEmote(4)", "SendWarningMsg(\"OMG, HI!\")"}
local f = load(getitr(cmds) , "Load Example")
f()

Notes Edit

Related Functions Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.