Regards
Augustas
os["pullEvent"] == os.pullEvent
os["pullEvent"]() == os.pullEvent()
The keys in the table are the function names:os["pullEvent"] == os.pullEvent os["pullEvent"]() == os.pullEvent()
well of course… I was saying they are equivalent, os.pullEvent() calls the same function as os["pullEvent"]()Not that it has anything to do with anything, but that second line will return false if you cause two different events to happen consecutively. :P/>/>/>The keys in the table are the function names:os["pullEvent"] == os.pullEvent os["pullEvent"]() == os.pullEvent()
then use your words 'is equivalent to' 'cause I thought you were doing a comparison on it at first too.well of course… I was saying they are equivalent, os.pullEvent() calls the same function as os["pullEvent"]()
An API is a regular table. You can set custom keys in tables whenever you want.Ok, I understand, thanks, I thought that an API was a regular table, so I've tested but forgot to do the (), so then I thought an API wasn't a regular table of functions, so I asked here for solely that purpose, and I've just realised my mistake. Thank you! :)/>/>
local t = {}
t["a"] = function() print(5) end
t.a()
return{
foo = function( text )
print( text )
end;
test = function( text )
print( #text )
end;
}
Main file
local api = require( "<API file>" )
api.foo( "bar" )
Hellkid, you should know by now that we don't have require in ComputerCraft, you should avoid confusing people with features we don't have…As said above by people, it's a table with functions.
You could for example do this
API fileMain filereturn{ foo = function( text ) print( text ) end; test = function( text ) print( #text ) end; }
local api = require( "<API file>" ) api.foo( "bar" )
Edit: Why are you trying to serialize an api? O_o
An API is a regular table. You can set custom keys in tables whenever you want.Ok, I understand, thanks, I thought that an API was a regular table, so I've tested but forgot to do the (), so then I thought an API wasn't a regular table of functions, so I asked here for solely that purpose, and I've just realised my mistake. Thank you! :)/>/>local t = {} t["a"] = function() print(5) end t.a()
Sorry. It's easier to understand when proper grammar and spelling are used. I'm guessing English isn't your first language?An API is a regular table. You can set custom keys in tables whenever you want.Ok, I understand, thanks, I thought that an API was a regular table, so I've tested but forgot to do the (), so then I thought an API wasn't a regular table of functions, so I asked here for solely that purpose, and I've just realised my mistake. Thank you! :)/>/>/>/>local t = {} t["a"] = function() print(5) end t.a()
I never said an API wasn't a regular table. Where you quoted me I said that earlier I thought it wasn't, but know I know it is. Is it just me, or you don't get anything I write? No offense but it's just frustrating for me.
Sorry.. I've gotten more used to LÖVE under the last month :P/>Hellkid, you should know by now that we don't have require in ComputerCraft, you should avoid confusing people with features we don't have…
Sorry. It's easier to understand when proper grammar and spelling are used. I'm guessing English isn't your first language?An API is a regular table. You can set custom keys in tables whenever you want.Ok, I understand, thanks, I thought that an API was a regular table, so I've tested but forgot to do the (), so then I thought an API wasn't a regular table of functions, so I asked here for solely that purpose, and I've just realised my mistake. Thank you! :)/>/>/>/>local t = {} t["a"] = function() print(5) end t.a()
I never said an API wasn't a regular table. Where you quoted me I said that earlier I thought it wasn't, but know I know it is. Is it just me, or you don't get anything I write? No offense but it's just frustrating for me.