Jump to content




Extended String Library

api lua utility

  • This topic is locked This topic is locked
31 replies to this topic

#21 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 14 January 2013 - 04:18 PM

View PostNeverCast, on 14 January 2013 - 04:16 PM, said:

There must be a way to remove this ( Besides replace bios.lua )! *Hacker Face!*
glhf and tell me if you manage it without rewrites...

#22 Eric

  • Members
  • 92 posts
  • LocationUK

Posted 14 January 2013 - 08:47 PM

View PostTheOriginalBIT, on 14 January 2013 - 04:18 PM, said:

View PostNeverCast, on 14 January 2013 - 04:16 PM, said:

There must be a way to remove this ( Besides replace bios.lua )! *Hacker Face!*
glhf and tell me if you manage it without rewrites...

Something like this could probably do it, with:

real_getmetatable = select(some_n, steal_stack(getmetatable))


#23 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 14 January 2013 - 08:52 PM

View PostEric, on 14 January 2013 - 08:47 PM, said:

Something like this could probably do it, with:

real_getmetatable = select(some_n, steal_stack(getmetatable))

Is there meant to be a code download on that page or something? Because last I checked steal_stack wasn't a function in Lua

#24 Eric

  • Members
  • 92 posts
  • LocationUK

Posted 15 January 2013 - 11:38 AM

View PostTheOriginalBIT, on 14 January 2013 - 08:52 PM, said:

View PostEric, on 14 January 2013 - 08:47 PM, said:

Something like this could probably do it, with:

real_getmetatable = select(some_n, steal_stack(getmetatable))

Is there meant to be a code download on that page or something? Because last I checked steal_stack wasn't a function in Lua

Yep, the code is:
local steal_stack = loadstring("\27\76\117\97\81\0\1\4\4\4\8\0\0\0\0\0\0\0\0\0\7\0\0\0\0\1\2\250\4\0\0\0\65\62\0\0\101\0\0\0\28\64\0\0\94\0\0\0\1\0\0\0\0\0\0\0\0\4\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\7\0\0\0\0\0\0\0\0\0\0\0");

Unfortunately, that doesn't work in CC, presumably since luaJ uses a stackless VM...

#25 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 15 January 2013 - 11:51 AM

View PostEric, on 15 January 2013 - 11:38 AM, said:

Yep, the code is:
local steal_stack = loadstring("\27\76\117\97\81\0\1\4\4\4\8\0\0\0\0\0\0\0\0\0\7\0\0\0\0\1\2\250\4\0\0\0\65\62\0\0\101\0\0\0\28\64\0\0\94\0\0\0\1\0\0\0\0\0\0\0\0\4\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\7\0\0\0\0\0\0\0\0\0\0\0");
Where was that?! I couldn't see that on there... never mind I now see it... damn byte code, didn't stand out to me :P

View PostEric, on 15 January 2013 - 11:38 AM, said:

Unfortunately, that doesn't work in CC, presumably since luaJ uses a stackless VM...
Damn... oh well...

#26 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 15 January 2013 - 11:54 AM

Byte code is what I'll be using, the Endianess of LuaJ has put me a bit behind, but spitting out functions to compiled bytecode, pulling out the chunk string and changing the bytecode, then reloading it back in to a function and reassigning the function should do it. It's a long shot and I'll be a while before I'm confident enough with my Lua Bytecode

#27 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 15 January 2013 - 11:56 AM

View PostNeverCast, on 15 January 2013 - 11:54 AM, said:

Byte code is what I'll be using, the Endianess of LuaJ has put me a bit behind, but spitting out functions to compiled bytecode, pulling out the chunk string and changing the bytecode, then reloading it back in to a function and reassigning the function should do it. It's a long shot and I'll be a while before I'm confident enough with my Lua Bytecode
Yeh I'm not even going to bother with bytecode...

#28 Eric

  • Members
  • 92 posts
  • LocationUK

Posted 15 January 2013 - 11:59 AM

View PostNeverCast, on 15 January 2013 - 11:54 AM, said:

Byte code is what I'll be using, the Endianess of LuaJ has put me a bit behind, but spitting out functions to compiled bytecode, pulling out the chunk string and changing the bytecode, then reloading it back in to a function and reassigning the function should do it. It's a long shot and I'll be a while before I'm confident enough with my Lua Bytecode
Not sure you can pull off the "reloading it back in to a function" step. A quick test shows it's more complicated:
> ms = string.dump(getmetatable)
> loaded_getmetatable = loadstring(ms)
> getmetatable({})
> loaded_getmetatable({})
string:-1: vm error: java.lang.NullPointerException
> string.dump(loaded_getmetatable) == string.dump(getmetatable)
true


#29 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 18 January 2013 - 11:36 AM

Update!
v2.2
  • Added 4 new functions: isLower, isUpper, isAlpha, is AlphaNumeric


#30 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 18 January 2013 - 10:43 PM

Request: isHexidecimal

#31 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 19 January 2013 - 01:11 AM

View PostGravityScore, on 18 January 2013 - 10:43 PM, said:

Request: isHexidecimal
Done! And more! :P

Update
v2.3
  • FIXED: isLower, isUpper, isAlpha, isAlphaNumeric — all now use pattern matching
  • ADDED: isNumeric, isPunctuation, isHexadecimal


#32 AfterLifeLochie

    Wiki Oracle

  • Moderators
  • 480 posts
  • LocationAfterLifeLochie's "Dungeon", Australia

Posted 25 January 2013 - 12:48 AM

Locked by request.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users