• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua How to a lua code execute another lua code?

Iblop

New Member
Joined
Dec 24, 2010
Messages
15
Reaction score
1
I have a simple lua code (a talkaction) and I need to make this code execute another code
Sample1.lua:
Code:
...
local test = Hello
if math.random(1,100) <= 33 then 
--here the function that execute Sample2.lua
end
...

Sample2.lua
Code:
doCreatureSay(cid, test, 2)

How can I make it?
 
copy the code from sample2 and put it at the top of sample1. put it inside a function
Code:
local function sample2()
stuff that was in sample2.lua
end

local test = Hello
if math.random(1,100) <= 33 then 
--here the function that execute sample2()
end
 
Back
Top