User Tools

Site Tools


lua:sharedtable

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
lua:sharedtable [2015/09/28 06:16]
vodur
lua:sharedtable [2015/09/28 09:36] (current)
vodur
Line 128: Line 128:
 ==== Sharing with different prog types ==== ==== Sharing with different prog types ====
  
-All prog types have access to '​shared'​ table (mprog/​oprog/​aprog/​rprog). However, if all your shared code is in mprog 1234 (as above example), only mprogs can easily load this code using loadprog. Loadprog called from oprog can only load oprogs, and similarly with aprog and rprog.+All prog types have access to '​shared'​ table (mprog/​oprog/​aprog/​rprog). However, if all your shared code is in mprog 1234 (as above example), only mprogs can easily load this code using [[:lua:ch:loadprog|loadprog]]. Loadprog called from oprog can only load oprogs, and similarly with aprog and rprog.
  
 One strategy to overcome this limitation is to keep all the shared code in an aprog and load it from the different prog types accordingly:​ One strategy to overcome this limitation is to keep all the shared code in an aprog and load it from the different prog types accordingly:​
Line 175: Line 175:
 </​code>​ </​code>​
  
-Using '​**loadscript**'​ is also an option:+Using '**[[:​lua:​loadscriptfunction|loadscript]]**' is also an option: 
 <code lua> <code lua>
 -- helpers_example.lua,​ shared helper functions for all prog types -- helpers_example.lua,​ shared helper functions for all prog types
lua/sharedtable.txt · Last modified: 2015/09/28 09:36 by vodur