User Tools

Site Tools


lua:scriptenvironments

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
lua:scriptenvironments [2015/10/17 21:29] – [getpc() and getroom()] aethynlua:scriptenvironments [2016/02/08 04:45] (current) – [Script Environments] vodur
Line 1: Line 1:
 ====== Script Environments ====== ====== Script Environments ======
  
-With the exception of the [[:lua:sharedtable|shared table]] all Lua scripts run in the environment they're first called upon and by default have no access to variables or methods in other environmentsThese environments are the OBJCH/MOB, ROOM, AREA spaces, along with few others. There are several ways to "break out" of an environment and affect external environments.+All prog scripts run in the scripting environment that is attached to the game object to which the trigger is attached. For instance, mprogs run in the environment of the mob that is running the scriptEach individual environment represents the "global" scope for the scriptand thusly "global" variable or function in one environment cannot be accessed from a script running in a different environment. 
 + 
 +There are a few ways to share values between different script environments, the most simple to use being [[:lua:sharedtable|shared table]].
  
 ===== Simple interactions ===== ===== Simple interactions =====
lua/scriptenvironments.1445117357.txt.gz · Last modified: 2015/10/17 21:29 by aethyn