Jump to content

ixjf

Members
  • Posts

    647
  • Joined

  • Last visited

Everything posted by ixjf

  1. Compiled* (because encryption is not compilation, unless you are talking about the encryption method that MTA recently implemented) Lua code, yes, it's as simple as opening the file with any text editor.
  2. You can still see function names and strings in compiled Lua code.
  3. I'd rather remove all of these mods you got.
  4. I cannot reproduce that - local variables stay in the scope of the function created by loadstring and shouldn't exist outside of it. Do you have some code that I can use to attempt to reproduce your issue? Yes, this is an alternative, but the code loaded at env will be able to access functions that were defined in the default environment, and as such, it may call these functions and cause issues.
  5. I think you still didn't get what an environment is or how it works. Every function, every variable (except locals, which are stored somewhere else) is stored in the environment table. The default environment is _G. Whenever you call a function, Lua attempts to find it in the environment table - it is the same as _G["function_name"] ( ... ) or even _G.function_name ( ... ) (which is syntatic sugar). Locals are not stored in the environment, that's why using local variables is faster than using global ones - you avoid a lookup in the environment table, which may be very slow if it is big enough. When you set the environment in which a function will run, you're telling it to assume the environment is, e.g. your table env. Now, whenever it calls a function, instead of attempting to find the function in _G, it attempts to find it in env. env is empty, therefore it is going to fail. This is why it fails to load your code. root is a constant variable that contains the root element. It is the same as calling getRootElement, although faster since the value is already stored, you don't need to call the function over and over. I assume root is not defined in your environment table, and that's your problem.
  6. Can you send me all of the source code (either here or via PM, if you don't want to share it with everybody) so I can see what you're doing?
  7. It's a placeholder for absent sub-domains, as I said in your other topic.
  8. Is that all of your code? Do you ever initialize your environment with required functions?
  9. That snippet of code is irrelevant. You talk about an issue on setfenv call but you show nothing about it.
  10. Mind showing your loader code?
  11. Can you enumerate them? It's as simple as clearing a table, what's your problem? Event handlers are removed automatically when the element is deleted.
  12. viewtopic.php?f=91&t=69031#p644203 Read from there on. And, for k,v in pairs ( _G ) do if ( not ( k == "cacheFiles" or k == "loadData" or k == "unloadAll" or k == "_G" ) ) then RUNCODE[k] = v end end
  13. I'm unable to reproduce this. Are you sure the string passed to loadstring is valid code and that the function is returning the correct result? Also, is this code being executed on the client or server? This is the code I used on the server side: local env = {} env.outputServerLog = outputServerLog local func = loadstring ( "outputServerLog ( \"hey\" )" ) local _func = loadstring ( "var = 1" ) outputServerLog ( tostring ( func ) ) outputServerLog ( tostring ( _func ) ) setfenv ( func, env ) setfenv ( _func, env ) outputServerLog ( tostring ( pcall ( func ) ) ) outputServerLog ( tostring ( pcall ( _func ) ) ) outputServerLog ( "var: " .. env.var ) Output: function: 01C06C78 function: 01C06CB8 hey true true var: 1
  14. It's a placeholder for absent sub-domains. The community is working just fine, though.
  15. setfenv should work just fine. It didn't work for me. Don't know if I did it right. Is there a way to get rid of variables without restarting the resource? Bonsai If you use separate environments, just clear it (or delete it completely) - it's all just a table.
  16. I'd rather run the code in a secure, separate environment (sandbox): http://lua-users.org/wiki/SandBoxes
  17. Actually, THGM was answered on IRC already - the MTA server is indeed multi-threaded.
  18. I don't see the point of such an event. What would it be useful for? You can always wrap createElement to catch script-created elements and call your own event if you really need that. It's not going to happen, stop attempting to copy other servers.
  19. What touchpad doesn't allow scrolling? Regardless, you can change the key yourself to meet your needs if you really need to.
  20. ixjf

    MAC OS X

    That's most likely not going to happen. You may want to give CrossOver or Wine a try, though.
  21. I don't get your question. Are you suggesting that the MTA team adds specific functionality to magically create a multi-arena system? No, that ain't going to happen. MTA provides you enough to do everything you just said on your own.
  22. You can format strings in Lua with string.format.
  23. There are already functions to draw 3D lines which can also be used to draw other primitives: dxDrawLine3D, dxDrawMaterialLine3D and dxDrawMaterialSectionLine3D.
  24. Compilation is not encryption - those are different concepts. You don't decompile encrypted data, you decrypt encrypted data.
  25. No. MySQL is a database management system. SQL is a language.
×
×
  • Create New...