|
Post by Exilereven on Jan 29, 2018 20:59:50 GMT
Just make sure you load it at the beginning of your script so you can call the functions later.
|
|
timtim
Junior Member
Posts: 67
|
Post by timtim on Jan 29, 2018 23:14:22 GMT
Here is what I tried and it did not work for some reason 1) I am running this in NOX 2) Created a simple file "calling it importLibrary 01 github.lua" with these few lines:- luaLib = loadstring(httpGet("https://raw.githubusercontent.com/mercobots/luaLib/master/luaLib.lua")) luaLib()
s,t = get_clock(1000)
print(s) print_r(t)
3) When trying to run, I get this error Runtime error: /sdcard/ankulua/importLibrary01 github.lua:7: attempt to call global 'httpGet (a nil value) stack traceback: /sdcard/ankulua/importLibrary01 github.lua:7 in main chunk
|
|
timtim
Junior Member
Posts: 67
|
Post by timtim on Jan 29, 2018 23:22:29 GMT
luaLib = loadstring("/storage/emulated/legacy/Ankulua/luaLib.lua")
luaLib()
s,t = get_clock(1000)
print(s)
print_r(t)
Then I tried this, hoping that local path would work, calling this file but got error
-- Runtime error: /sdcard/ankulua/importLibrary 02 nox path.lua:2: attempt to call global 'luaLib(a nil value) stack traceback: /sdcard/ankulua/importLibrary 02 nox path.lua:2 in main chunk
PS: The luaLib.lua is in the same path
|
|
|
Post by Exilereven on Jan 30, 2018 4:12:08 GMT
I don't think your understanding correctly.
Just leave it alone exactly how it is, and it will load everything you can already at the beginning, don't change anything in anything just run it like it shows to load directly and that's it, just have it at the top of your script and you can use any function inside of it.
|
|
timtim
Junior Member
Posts: 67
|
Post by timtim on Jan 30, 2018 7:57:03 GMT
Sorry bear with me , I am a newbee to Ankulua. My aim is to use your library, but I am probably doing something wrong. FilesThese are the two things I have tried so far, giving snapshots, so may be it would be clearer. 1) I have tried to give the git path with http get Ankulua FileError2) Tried to give the actual directory path where I downloaded and kept "luaLib.lua" on the android (in NOX emulator) But in both cases got differen error. Ankulua File 02Error
PS: I am not sure why forum is not allowing me to insert image directly. I will try to find later.
|
|
timtim
Junior Member
Posts: 67
|
Post by timtim on Jan 30, 2018 8:38:03 GMT
Was able to find something and make it work but if you have a better suggestion, please let me know
localPath = scriptPath()
print("LocalPath = " .. localPath)
dofile(localPath.."luaLib.lua")
--luaLib = loadstring("/sdcard/Ankulua/luaLib.lua")
--luaLib()
s,t = get_clock(1000)
print(s)
print_r(t)
|
|
|
Post by lenra77 on Apr 1, 2018 0:58:30 GMT
How do I add objects on a table and extract the information for later use? Let's say in a game where certain mobs has specific respawn cooldown which only resets once it is killed. I'm thinking of something like this
myTable = {} thismob = mobname, respawncd, timedied, newrespawntime
If I have more than 1 monster to track how do I add "thismob" to "myTable" then update the table each time a monster is killed?
|
|
|
Post by Mercobots on Apr 3, 2018 13:04:17 GMT
How do I add objects on a table and extract the information for later use? Let's say in a game where certain mobs has specific respawn cooldown which only resets once it is killed. I'm thinking of something like this myTable = {} thismob = mobname, respawncd, timedied, newrespawntime If I have more than 1 monster to track how do I add "thismob" to "myTable" then update the table each time a monster is killed? You will need 2 tables , 1 with mobs information and another one for current kills mobs = { { id = 'mob_1', cd = 60 -- seconds }, { id = 'mob_2', cd = 120 -- seconds } }
-- code -- data table for all mobs killed data = { {mod = mobs[i] , died = Timer() }, {mod = mobs[i] , died = Timer() }, {mod = mobs[i] , died = Timer() }, {mod = mobs[i] , died = Timer() }, }
|
|
|
Post by podahmad on Jun 19, 2019 14:40:05 GMT
mercobotsIm using copy files and its not giving error but copy is not being done can u please give example of copy fucntion
|
|
|
Post by Exilereven on Jun 19, 2019 16:40:55 GMT
I don't mess with copy very much but I'll see if I can explain example.
copy(path source string, path destination string) copy a directory or file, return true or false
So this is saying:
--you can setup variable or use direct path, I'm going to use variable here.
local source = "scriptPath() .. "source_folder_name\source.lua"
local destination = "scriptPath() .. "destination_folder_name\destination.lua"
copy(source,destination)
Hope this helps. Post exactly what your trying to do, or your current part of script your working on and we can help you better.
|
|
|
Post by podahmad on Jun 19, 2019 23:39:16 GMT
I don't mess with copy very much but I'll see if I can explain example. copy(path source string, path destination string) copy a directory or file, return true or false So this is saying: --you can setup variable or use direct path, I'm going to use variable here. local source = "scriptPath() .. "source_folder_name\source.lua" local destination = "scriptPath() .. "destination_folder_name\destination.lua" copy(source,destination) Hope this helps. Post exactly what your trying to do, or your current part of script your working on and we can help you better. Thank you for your thorough response im now able to copy files The problem im facing now is the file need to be in 777 permission status but ankulua set it to 700 how can i solve this..plz help
|
|
Eebado
Contributors
Posts: 165
|
Post by Eebado on Nov 4, 2020 14:50:26 GMT
Just wanted to bump this as I found it far down the page and is very helpful!
|
|