Jump to content




Create apis without unloading or setting apis


  • You cannot reply to this topic
2 replies to this topic

#1 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

Posted 01 March 2016 - 05:36 PM

I can't get the pictures to show up??
Sometimes a program will create Apis without having to be set as Apis. For example, the shell.


You can also do this. For example, I did it:



To do this follow these steps:
Enter somewhere that runs Lua:
type:
lua

Create an index:
type:
myIndex={}

Make Your Index Global:
type:
_G.myIndex = myIndex\

Make a function under the index:
type:
myIndex.myFunction(){print('test');}

test your function
type:
myIndex.myFunction()

You can also do this in the edit program:

Edited by everyOS, 01 March 2016 - 05:42 PM.


#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 01 March 2016 - 06:08 PM

myIndex.myFunction(){print('test');}

Is not valid lua. This is:

myIndex.myFunction() print('test'); end


#3 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 05 March 2016 - 04:18 PM

also you need to either use the set operator or the fuction keyword like so:
myIndex.myFunction = function() print('test') end
function myIndex.myFunction() print('test') end






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users