load

Loads chunk ld (or, if ld is a function, loads the chunk returned by it) as a function and returns it. Error messages use source if available, or a representation of ld.

ExampleLoading a string
Prints "Hello World" from a loaded function
Code
load("print('Hello World')")()
Output Hello World

load
Function
Syntax
load(
  • ld : various
  • source? : string
)

Returns function or nil
API Base globals
Source CC:Tweaked
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.